package com.hgw.Demo01_proxyPattern.staticProxy;

/**
 * Data time:2021/12/13 15:08
 * StudentID:2019112118
 * Author:hgw
 * Description: 代理主题角色
 */
public class ProxyPoint implements SellTickets{

    // 维持一个对真实主题对象的引用
    private TrainStation trainStation = new TrainStation();

    public void preRequest() {
        System.out.println("代理之前");
    }

    @Override
    public void sell() {
        preRequest();
        trainStation.sell(); // 调用真实主题对象的方法
        postRequest();
    }

    public void postRequest() {
        System.out.println("代理之后");
    }
}
